package io.renren.modules.cus.service.impl;

import io.renren.datasources.DataSourceNames;
import io.renren.datasources.annotation.DataSource;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.cus.dao.TPmUserDao;
import io.renren.modules.cus.entity.TPmUserEntity;
import io.renren.modules.cus.service.TPmUserService;


@Service("TPmUserService")
public class TPmUserServiceImpl extends ServiceImpl<TPmUserDao, TPmUserEntity> implements TPmUserService {

    @Override
    @DataSource(name = DataSourceNames.SECOND)
    public PageUtils queryPage(Map<String, Object> params) {
        Page<TPmUserEntity> page = this.selectPage(
                new Query<TPmUserEntity>(params).getPage(),
                new EntityWrapper<TPmUserEntity>()
        );
        page.setTotal(selectCount(new EntityWrapper<TPmUserEntity>()));
        return new PageUtils(page);
    }

}
